<!--
  This file is a part of the open-eBackup project.
  This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
  If a copy of the MPL was not distributed with this file, You can obtain one at
  http://mozilla.org/MPL/2.0/.
  
  Copyright (c) [2024] Huawei Technologies Co.,Ltd.
  
  THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
  EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
  MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
  -->

<div class="aui-fullpage security-policy-page">
  <div class="aui-header-1">
    <lv-group lvGutter="8px">
      <h1>{{ 'common_host_trustworthiness_op_label' | i18n }}</h1>
      <aui-multi-cluster-switch (onChange)="onChange()"></aui-multi-cluster-switch>
    </lv-group>
  </div>
  <div class="aui-block  aui-gutter-column-md security-policy-container">
    <div class="aui-header-2">
      <h2>{{ 'common_host_trustworthiness_setting_label' | i18n }}</h2>
      <div pmpermission pmOperation='ModifyHostTrustWorthiness'>
        <lv-group lvGutter="10px" *ngIf="!viewSettingFlag">
          <span class="aui-link" (click)="saveEncryptionPolicy()">
            {{ 'common_save_label' | i18n }}
          </span>
          <span class="aui-link" (click)="cancelEncryptionPolicy()">
            {{ 'common_cancel_label' | i18n }}
          </span>
        </lv-group>
        <span *ngIf="viewSettingFlag" class="aui-link" (click)="modifyEncryptionPolicy()">
          {{ 'common_modify_label' | i18n }}
        </span>
      </div>
    </div>
    <div class="dashed-line"></div>
    <div *ngIf="viewSettingFlag">
      <lv-form>
        <lv-form-item>
          <lv-form-label>{{ 'common_host_trust_label' | i18n }}
            <i lv-icon="aui-icon-help" lv-tooltip="{{ 'common_host_trust_switch_tips_label' | i18n }}"
              lvTooltipPosition="rightTop" lvTooltipTheme="light" class="configform-constraint" lvColorState="true"></i>
          </lv-form-label>

          <lv-form-control>
            {{ replicationLinkEncryption | textMap: 'Switch_Status' }}
          </lv-form-control>
        </lv-form-item>
      </lv-form>
    </div>
    <div *ngIf="!viewSettingFlag">
      <lv-form [formGroup]="formGroup">
        <lv-form-item>
          <lv-form-label>{{ 'common_host_trust_label' | i18n }}
            <i lv-icon="aui-icon-help" lv-tooltip="{{ 'common_host_trust_switch_tips_label' | i18n }}"
              lvTooltipPosition="rightTop" lvTooltipTheme="light" class="configform-constraint" lvColorState="true"></i>
          </lv-form-label>
          <lv-form-control>
            <lv-switch formControlName="replicationLinkEncryption"> </lv-switch>
          </lv-form-control>
        </lv-form-item>
      </lv-form>
    </div>
  </div>
</div>